Skip to content

🛡️ Sentinel: [CRITICAL] Add authorization checks to AdminController - #201

Closed
seonghobae wants to merge 1 commit into
mainfrom
sentinel/fix-admin-auth-1027780027417743454
Closed

🛡️ Sentinel: [CRITICAL] Add authorization checks to AdminController#201
seonghobae wants to merge 1 commit into
mainfrom
sentinel/fix-admin-auth-1027780027417743454

Conversation

@seonghobae

@seonghobae seonghobae commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

Superseded by #172, the canonical admin authorization change. #172 enforces separate read/write permissions on all admin operations and has successful current-head validation.

This commit addresses a critical security vulnerability where the administrative
API endpoints (`getAllJobs`, `deleteJob`, `retryDeadLettered`) lacked proper
tenant-based authorization.

The `AdminController` was updated to require explicit `ADMIN_READ` or
`ADMIN_WRITE` permissions by injecting the `TenantAccessService` and asserting
these required permissions using the provided request headers.

Unit tests were updated to include these mocked services and dummy headers to
maintain 100% test coverage and ensure future stability.
@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copilot AI review requested due to automatic review settings July 24, 2026 21:16

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens Clearfolio’s admin conversion-job endpoints by enforcing tenant-claim authentication and explicit admin permissions via TenantAccessService, reducing the risk of unauthorized cross-tenant job access/mutation.

Changes:

  • Enforced ADMIN_READ/ADMIN_WRITE permission checks on AdminController endpoints using request headers.
  • Added admin:read and admin:write permission constants to TenantPermissions.
  • Updated AdminControllerTest scaffolding for the new controller signature and added request headers in test calls; documented the learning in .jules/sentinel.md.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
src/main/java/com/clearfolio/viewer/controller/AdminController.java Adds TenantAccessService enforcement for admin read/write endpoints.
src/main/java/com/clearfolio/viewer/auth/TenantPermissions.java Introduces new admin permission constants used by the controller.
src/test/java/com/clearfolio/viewer/controller/AdminControllerTest.java Updates controller construction and request setup for new auth checks.
.jules/sentinel.md Records the security learning entry for this vulnerability class.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 6 to +10
import java.util.Arrays;
import java.util.UUID;

import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
Comment on lines +101 to 102
tenantAccessService.require(headers, com.clearfolio.viewer.auth.TenantPermissions.ADMIN_WRITE);
RetryDeadLetterResult result = conversionService.retryDeadLettered(jobId, "admin");
Comment on lines +39 to +41
TenantContext dummyContext = new TenantContext("test-tenant", "test-subject", java.util.Set.of());
when(tenantAccessService.require(any(), eq(TenantPermissions.ADMIN_READ))).thenReturn(dummyContext);
when(tenantAccessService.require(any(), eq(TenantPermissions.ADMIN_WRITE))).thenReturn(dummyContext);
@seonghobae seonghobae closed this Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants